home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / CIncludes / AppleTalk.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-12  |  47.3 KB  |  1,406 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        AppleTalk.h
  3.  
  4.      Contains:    AppleTalk Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1985-1997 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __APPLETALK__
  19. #define __APPLETALK__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __OSUTILS__
  25. #include <OSUtils.h>
  26. #endif
  27.  
  28.  
  29.  
  30. #if PRAGMA_ONCE
  31. #pragma once
  32. #endif
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37.  
  38. #if PRAGMA_IMPORT
  39. #pragma import on
  40. #endif
  41.  
  42. #if PRAGMA_STRUCT_ALIGN
  43.     #pragma options align=mac68k
  44. #elif PRAGMA_STRUCT_PACKPUSH
  45.     #pragma pack(push, 2)
  46. #elif PRAGMA_STRUCT_PACK
  47.     #pragma pack(2)
  48. #endif
  49.  
  50.  
  51. enum {
  52.                                                                 /* Driver unit numbers (ADSP is dynamic) */
  53.     mppUnitNum                    = 9,                            /* MPP unit number */
  54.     atpUnitNum                    = 10,                            /* ATP unit number */
  55.     xppUnitNum                    = 40                            /* XPP unit number */
  56. };
  57.  
  58.  
  59. enum {
  60.                                                                 /* Driver refNums (ADSP is dynamic) */
  61.     mppRefNum                    = -10,                            /* MPP reference number */
  62.     atpRefNum                    = -11,                            /* ATP reference number */
  63.     xppRefNum                    = -41                            /* XPP reference number */
  64. };
  65.  
  66.  
  67. enum {
  68.                                                                 /* .MPP csCodes */
  69.     lookupReply                    = 242,                            /* This command queued to ourself */
  70.     writeLAP                    = 243,                            /* Write out LAP packet */
  71.     detachPH                    = 244,                            /* Detach LAP protocol handler */
  72.     attachPH                    = 245,                            /* Attach LAP protocol handler */
  73.     writeDDP                    = 246,                            /* Write out DDP packet */
  74.     closeSkt                    = 247,                            /* Close DDP socket */
  75.     openSkt                        = 248,                            /* Open DDP socket */
  76.     loadNBP                        = 249,                            /* Load NBP command-executing code */
  77.     lastResident                = 249,                            /* Last resident command */
  78.     confirmName                    = 250,                            /* Confirm name */
  79.     lookupName                    = 251,                            /* Look up name on internet */
  80.     removeName                    = 252,                            /* Remove name from Names Table */
  81.     registerName                = 253,                            /* Register name in Names Table */
  82.     killNBP                        = 254,                            /* Kill outstanding NBP request */
  83.     unloadNBP                    = 255,                            /* Unload NBP command code */
  84.     setSelfSend                    = 256,                            /* MPP: Set to allow writes to self */
  85.     SetMyZone                    = 257,                            /* Set my zone name */
  86.     GetATalkInfo                = 258,                            /* get AppleTalk information */
  87.     ATalkClosePrep                = 259                            /* AppleTalk close query */
  88. };
  89.  
  90.  
  91. enum {
  92.                                                                 /* .ATP csCodes */
  93.     nSendRequest                = 248,                            /* NSendRequest code */
  94.     relRspCB                    = 249,                            /* Release RspCB */
  95.     closeATPSkt                    = 250,                            /* Close ATP socket */
  96.     addResponse                    = 251,                            /* Add response code | Require open skt */
  97.     sendResponse                = 252,                            /* Send response code */
  98.     getRequest                    = 253,                            /* Get request code */
  99.     openATPSkt                    = 254,                            /* Open ATP socket */
  100.     sendRequest                    = 255,                            /* Send request code */
  101.     relTCB                        = 256,                            /* Release TCB */
  102.     killGetReq                    = 257,                            /* Kill GetRequest */
  103.     killSendReq                    = 258,                            /* Kill SendRequest */
  104.     killAllGetReq                = 259                            /* Kill all getRequests for a skt */
  105. };
  106.  
  107.  
  108. enum {
  109.                                                                 /* .XPP csCodes */
  110.     openSess                    = 255,                            /* Open session */
  111.     closeSess                    = 254,                            /* Close session */
  112.     userCommand                    = 253,                            /* User command */
  113.     userWrite                    = 252,                            /* User write */
  114.     getStatus                    = 251,                            /* Get status */
  115.     afpCall                        = 250,                            /* AFP command (buffer has command code) */
  116.     getParms                    = 249,                            /* Get parameters */
  117.     abortOS                        = 248,                            /* Abort open session request */
  118.     closeAll                    = 247,                            /* Close all open sessions */
  119.     xCall                        = 246                            /* .XPP extended calls */
  120. };
  121.  
  122.  
  123. enum {
  124.                                                                 /* Transition Queue transition types */
  125.     ATTransOpen                    = 0,                            /*AppleTalk has opened*/
  126.     ATTransClose                = 2,                            /*AppleTalk is about to close*/
  127.     ATTransClosePrep            = 3,                            /*Is it OK to close AppleTalk ?*/
  128.     ATTransCancelClose            = 4                                /*Cancel the ClosePrep transition*/
  129. };
  130.  
  131.  
  132. enum {
  133.     afpByteRangeLock            = 1,                            /*AFPCall command codes*/
  134.     afpVolClose                    = 2,                            /*AFPCall command codes*/
  135.     afpDirClose                    = 3,                            /*AFPCall command codes*/
  136.     afpForkClose                = 4,                            /*AFPCall command codes*/
  137.     afpCopyFile                    = 5,                            /*AFPCall command codes*/
  138.     afpDirCreate                = 6,                            /*AFPCall command codes*/
  139.     afpFileCreate                = 7,                            /*AFPCall command codes*/
  140.     afpDelete                    = 8,                            /*AFPCall command codes*/
  141.     afpEnumerate                = 9,                            /*AFPCall command codes*/
  142.     afpFlush                    = 10,                            /*AFPCall command codes*/
  143.     afpForkFlush                = 11,                            /*AFPCall command codes*/
  144.     afpGetDirParms                = 12,                            /*AFPCall command codes*/
  145.     afpGetFileParms                = 13,                            /*AFPCall command codes*/
  146.     afpGetForkParms                = 14,                            /*AFPCall command codes*/
  147.     afpGetSInfo                    = 15,                            /*AFPCall command codes*/
  148.     afpGetSParms                = 16,                            /*AFPCall command codes*/
  149.     afpGetVolParms                = 17,                            /*AFPCall command codes*/
  150.     afpLogin                    = 18,                            /*AFPCall command codes*/
  151.     afpContLogin                = 19,                            /*AFPCall command codes*/
  152.     afpLogout                    = 20,                            /*AFPCall command codes*/
  153.     afpMapID                    = 21,                            /*AFPCall command codes*/
  154.     afpMapName                    = 22,                            /*AFPCall command codes*/
  155.     afpMove                        = 23,                            /*AFPCall command codes*/
  156.     afpOpenVol                    = 24,                            /*AFPCall command codes*/
  157.     afpOpenDir                    = 25,                            /*AFPCall command codes*/
  158.     afpOpenFork                    = 26,                            /*AFPCall command codes*/
  159.     afpRead                        = 27,                            /*AFPCall command codes*/
  160.     afpRename                    = 28,                            /*AFPCall command codes*/
  161.     afpSetDirParms                = 29,                            /*AFPCall command codes*/
  162.     afpSetFileParms                = 30,                            /*AFPCall command codes*/
  163.     afpSetForkParms                = 31,                            /*AFPCall command codes*/
  164.     afpSetVolParms                = 32,                            /*AFPCall command codes*/
  165.     afpWrite                    = 33,                            /*AFPCall command codes*/
  166.     afpGetFlDrParms                = 34,                            /*AFPCall command codes*/
  167.     afpSetFlDrParms                = 35,                            /*AFPCall command codes*/
  168.     afpDTOpen                    = 48,                            /*AFPCall command codes*/
  169.     afpDTClose                    = 49,                            /*AFPCall command codes*/
  170.     afpGetIcon                    = 51,                            /*AFPCall command codes*/
  171.     afpGtIcnInfo                = 52,                            /*AFPCall command codes*/
  172.     afpAddAPPL                    = 53,                            /*AFPCall command codes*/
  173.     afpRmvAPPL                    = 54,                            /*AFPCall command codes*/
  174.     afpGetAPPL                    = 55,                            /*AFPCall command codes*/
  175.     afpAddCmt                    = 56,                            /*AFPCall command codes*/
  176.     afpRmvCmt                    = 57,                            /*AFPCall command codes*/
  177.     afpGetCmt                    = 58,                            /*AFPCall command codes*/
  178.     afpAddIcon                    = 192                            /*Special code for ASP Write commands*/
  179. };
  180.  
  181.  
  182. enum {
  183.     xppLoadedBit                = 5,                            /* XPP bit in PortBUse */
  184.     scbMemSize                    = 192,                            /* Size of memory for SCB */
  185.     xppFlagClr                    = 0                                /* Cs for AFPCommandBlock */
  186. };
  187.  
  188.  
  189. enum {
  190.     xppFlagSet                    = 128                            /* StartEndFlag & NewLineFlag fields. */
  191. };
  192.  
  193.  
  194. enum {
  195.     lapSize                        = 20,
  196.     ddpSize                        = 26,
  197.     nbpSize                        = 26,
  198.     atpSize                        = 56
  199. };
  200.  
  201.  
  202. enum {
  203.     atpXOvalue                    = 32,                            /*ATP exactly-once bit */
  204.     atpEOMvalue                    = 16,                            /*ATP End-Of-Message bit */
  205.     atpSTSvalue                    = 8,                            /*ATP Send-Transmission-Status bit */
  206.     atpTIDValidvalue            = 2,                            /*ATP trans. ID valid bit */
  207.     atpSendChkvalue                = 1                                /*ATP send checksum bit */
  208. };
  209.  
  210.  
  211. enum {
  212.     zipGetLocalZones            = 5,
  213.     zipGetZoneList                = 6,
  214.     zipGetMyZone                = 7
  215. };
  216.  
  217.  
  218. enum {
  219.     LAPMgrPtr                    = 0x0B18                        /*Entry point for LAP Manager*/
  220. };
  221.  
  222.  
  223. enum {
  224.     LAPMgrCall                    = 2,                            /*Offset to LAP routines*/
  225.     LAddAEQ                        = 23,                            /*LAPAddATQ routine selector*/
  226.     LRmvAEQ                        = 24                            /*LAPRmvATQ routine selector*/
  227. };
  228.  
  229. #define MPPioCompletion MPP.ioCompletion
  230. #define MPPioResult MPP.ioResult
  231. #define MPPioRefNum MPP.ioRefNum
  232. #define MPPcsCode MPP.csCode
  233. #define LAPprotType LAP.protType
  234. #define LAPwdsPointer LAP.u.wdsPointer
  235. #define LAPhandler LAP.u.handler
  236. #define DDPsocket DDP.socket
  237. #define DDPchecksumFlag DDP.checksumFlag
  238. #define DDPwdsPointer DDP.u.wdsPointer
  239. #define DDPlistener DDP.u.listener
  240. #define NBPinterval NBP.interval
  241. #define NBPcount NBP.count
  242. #define NBPntQElPtr NBP.nbpPtrs.ntQElPtr
  243. #define NBPentityPtr NBP.nbpPtrs.entityPtr
  244. #define NBPverifyFlag NBP.parm.verifyFlag
  245. #define NBPretBuffPtr NBP.parm.Lookup.retBuffPtr
  246. #define NBPretBuffSize NBP.parm.Lookup.retBuffSize
  247. #define NBPmaxToGet NBP.parm.Lookup.maxToGet
  248. #define NBPnumGotten NBP.parm.Lookup.numGotten
  249. #define NBPconfirmAddr NBP.parm.Confirm.confirmAddr
  250. #define NBPnKillQEl NBPKILL.nKillQEl
  251. #define NBPnewSocket NBP.parm.Confirm.newSocket
  252. #define ATPioCompletion ATP.ioCompletion
  253. #define ATPioResult ATP.ioResult
  254. #define ATPuserData ATP.userData
  255. #define ATPreqTID ATP.reqTID
  256. #define ATPioRefNum ATP.ioRefNum
  257. #define ATPcsCode ATP.csCode
  258. #define ATPatpSocket ATP.atpSocket
  259. #define ATPatpFlags ATP.atpFlags
  260. #define ATPaddrBlock ATP.addrBlock
  261. #define ATPreqLength ATP.reqLength
  262. #define ATPreqPointer ATP.reqPointer
  263. #define ATPbdsPointer ATP.bdsPointer
  264. #define ATPtimeOutVal SREQ.timeOutVal
  265. #define ATPnumOfResps SREQ.numOfResps
  266. #define ATPretryCount SREQ.retryCount
  267. #define ATPnumOfBuffs OTH1.u.numOfBuffs
  268. #define ATPbitMap OTH1.u.bitMap
  269. #define ATPrspNum OTH1.u.rspNum
  270. #define ATPbdsSize OTH2.bdsSize
  271. #define ATPtransID OTH2.transID
  272. #define ATPaKillQEl KILL.aKillQEl
  273.  
  274. enum {
  275.     tLAPRead                    = 0,
  276.     tLAPWrite                    = 1,
  277.     tDDPRead                    = 2,
  278.     tDDPWrite                    = 3,
  279.     tNBPLookup                    = 4,
  280.     tNBPConfirm                    = 5,
  281.     tNBPRegister                = 6,
  282.     tATPSndRequest                = 7,
  283.     tATPGetRequest                = 8,
  284.     tATPSdRsp                    = 9,
  285.     tATPAddRsp                    = 10,
  286.     tATPRequest                    = 11,
  287.     tATPResponse                = 12
  288. };
  289.  
  290. typedef SInt8                             ABCallType;
  291.  
  292. enum {
  293.     lapProto                    = 0,
  294.     ddpProto                    = 1,
  295.     nbpProto                    = 2,
  296.     atpProto                    = 3
  297. };
  298.  
  299. typedef UInt8                             ABProtoType;
  300. typedef Byte                             ABByte;
  301. struct LAPAdrBlock {
  302.     UInt8                             dstNodeID;
  303.     UInt8                             srcNodeID;
  304.     ABByte                             lapProtType;
  305.     UInt8                             filler;                        /*    Filler for proper byte alignment*/
  306. };
  307. typedef struct LAPAdrBlock LAPAdrBlock;
  308.  
  309. typedef struct ATQEntry                 ATQEntry;
  310. typedef ATQEntry *                        ATQEntryPtr;
  311. typedef CALLBACK_API_C( long , ATalkTransitionEventProcPtr )(long eventCode, ATQEntryPtr qElem, void *eventParameter);
  312. typedef STACK_UPP_TYPE(ATalkTransitionEventProcPtr)             ATalkTransitionEventUPP;
  313. typedef ATalkTransitionEventUPP         ATalkTransitionEvent;
  314. struct ATQEntry {
  315.     struct ATQEntry *                qLink;                        /*next queue entry*/
  316.     short                             qType;                        /*queue type*/
  317.     ATalkTransitionEventUPP         CallAddr;                    /*your routine descriptor*/
  318. };
  319.  
  320. /* 
  321.     Real definition of EntityName is 3 PACKED strings of any length (32 is just an example). No
  322.     offests for Asm since each String address must be calculated by adding length byte to last string ptr.
  323.     In Pascal, String(32) will be 34 bytes long since fields never start on an odd byte unless they are 
  324.     only a byte long. So this will generate correct looking interfaces for Pascal and C, but they will not
  325.     be the same, which is OK since they are not used. 
  326. */
  327. struct EntityName {
  328.     Str32Field                         objStr;
  329.     Str32Field                         typeStr;
  330.     Str32Field                         zoneStr;
  331. };
  332. typedef struct EntityName EntityName;
  333.  
  334. typedef EntityName *                    EntityPtr;
  335. struct AddrBlock {
  336.     UInt16                             aNet;
  337.     UInt8                             aNode;
  338.     UInt8                             aSocket;
  339. };
  340. typedef struct AddrBlock AddrBlock;
  341.  
  342. struct RetransType {
  343.     UInt8                             retransInterval;
  344.     UInt8                             retransCount;
  345. };
  346. typedef struct RetransType RetransType;
  347.  
  348. struct BDSElement {
  349.     short                             buffSize;
  350.     void *                            buffPtr;
  351.     short                             dataSize;
  352.     long                             userBytes;
  353. };
  354. typedef struct BDSElement BDSElement;
  355.  
  356. typedef BDSElement                         BDSType[8];
  357. typedef BDSElement *                    BDSPtr;
  358. typedef char                             BitMapType;
  359. struct ATLAPRec {
  360.     ABCallType                         abOpcode;
  361.     SInt8                             filler;                        /*    Filler for proper byte alignment*/
  362.     short                             abResult;
  363.     long                             abUserReference;
  364.     LAPAdrBlock                     lapAddress;
  365.     short                             lapReqCount;
  366.     short                             lapActCount;
  367.     void *                            lapDataPtr;
  368. };
  369. typedef struct ATLAPRec ATLAPRec;
  370.  
  371. typedef ATLAPRec *                        ATLAPRecPtr;
  372. typedef ATLAPRecPtr *                    ATLAPRecHandle;
  373. struct ATDDPRec {
  374.     ABCallType                         abOpcode;
  375.     SInt8                             filler;                        /*    Filler for proper byte alignment*/
  376.     short                             abResult;
  377.     long                             abUserReference;
  378.     short                             ddpType;
  379.     short                             ddpSocket;
  380.     AddrBlock                         ddpAddress;
  381.     short                             ddpReqCount;
  382.     short                             ddpActCount;
  383.     void *                            ddpDataPtr;
  384.     short                             ddpNodeID;
  385. };
  386. typedef struct ATDDPRec ATDDPRec;
  387.  
  388. typedef ATDDPRec *                        ATDDPRecPtr;
  389. typedef ATDDPRecPtr *                    ATDDPRecHandle;
  390. struct ATNBPRec {
  391.     ABCallType                         abOpcode;
  392.     SInt8                             filler;                        /*    Filler for proper byte alignment*/
  393.     short                             abResult;
  394.     long                             abUserReference;
  395.     EntityPtr                         nbpEntityPtr;
  396.     void *                            nbpBufPtr;
  397.     short                             nbpBufSize;
  398.     short                             nbpDataField;
  399.     AddrBlock                         nbpAddress;
  400.     RetransType                     nbpRetransmitInfo;
  401. };
  402. typedef struct ATNBPRec ATNBPRec;
  403.  
  404. typedef ATNBPRec *                        ATNBPRecPtr;
  405. typedef ATNBPRecPtr *                    ATNBPRecHandle;
  406. struct ATATPRec {
  407.     ABCallType                         abOpcode;
  408.     SInt8                             filler1;                    /*    Filler for proper byte alignment*/
  409.     short                             abResult;
  410.     long                             abUserReference;
  411.     short                             atpSocket;
  412.     AddrBlock                         atpAddress;
  413.     short                             atpReqCount;
  414.     void *                            atpDataPtr;
  415.     BDSPtr                             atpRspBDSPtr;
  416.     BitMapType                         atpBitMap;
  417.     SInt8                             filler2;                    /*    Filler for proper byte alignment*/
  418.     short                             atpTransID;
  419.     short                             atpActCount;
  420.     long                             atpUserData;
  421.     Boolean                         atpXO;
  422.     Boolean                         atpEOM;
  423.     short                             atpTimeOut;
  424.     short                             atpRetries;
  425.     short                             atpNumBufs;
  426.     short                             atpNumRsp;
  427.     short                             atpBDSSize;
  428.     long                             atpRspUData;
  429.     void *                            atpRspBuf;
  430.     short                             atpRspSize;
  431. };
  432. typedef struct ATATPRec ATATPRec;
  433.  
  434. typedef ATATPRec *                        ATATPRecPtr;
  435. typedef ATATPRecPtr *                    ATATPRecHandle;
  436. struct AFPCommandBlock {
  437.     UInt8                             cmdByte;
  438.     UInt8                             startEndFlag;
  439.     short                             forkRefNum;
  440.     long                             rwOffset;
  441.     long                             reqCount;
  442.     UInt8                             newLineFlag;
  443.     char                             newLineChar;
  444. };
  445. typedef struct AFPCommandBlock AFPCommandBlock;
  446.  
  447. typedef union MPPParamBlock             MPPParamBlock;
  448. typedef union ATPParamBlock             ATPParamBlock;
  449. typedef union XPPParamBlock             XPPParamBlock;
  450. typedef MPPParamBlock *                    MPPPBPtr;
  451. typedef ATPParamBlock *                    ATPPBPtr;
  452. typedef XPPParamBlock *                    XPPParmBlkPtr;
  453. typedef CALLBACK_API( void , MPPCompletionProcPtr )(MPPPBPtr thePBptr);
  454. /*
  455.     WARNING: MPPCompletionProcPtr uses register based parameters under classic 68k
  456.              and cannot be written in a high-level language without 
  457.              the help of mixed mode or assembly glue.
  458. */
  459. typedef CALLBACK_API( void , ATPCompletionProcPtr )(ATPPBPtr thePBptr);
  460. /*
  461.     WARNING: ATPCompletionProcPtr uses register based parameters under classic 68k
  462.              and cannot be written in a high-level language without 
  463.              the help of mixed mode or assembly glue.
  464. */
  465. typedef CALLBACK_API( void , XPPCompletionProcPtr )(XPPParmBlkPtr thePBptr);
  466. /*
  467.     WARNING: XPPCompletionProcPtr uses register based parameters under classic 68k
  468.              and cannot be written in a high-level language without 
  469.              the help of mixed mode or assembly glue.
  470. */
  471. typedef CALLBACK_API( void , AttnRoutineProcPtr )(short sessRefnum, short attnBytes);
  472. /*
  473.     WARNING: AttnRoutineProcPtr uses register based parameters under classic 68k
  474.              and cannot be written in a high-level language without 
  475.              the help of mixed mode or assembly glue.
  476. */
  477. typedef REGISTER_UPP_TYPE(MPPCompletionProcPtr)                 MPPCompletionUPP;
  478. typedef REGISTER_UPP_TYPE(ATPCompletionProcPtr)                 ATPCompletionUPP;
  479. typedef REGISTER_UPP_TYPE(XPPCompletionProcPtr)                 XPPCompletionUPP;
  480. typedef REGISTER_UPP_TYPE(AttnRoutineProcPtr)                     AttnRoutineUPP;
  481.  
  482. struct WDSElement {
  483.     short                             entryLength;
  484.     Ptr                             entryPtr;
  485. };
  486. typedef struct WDSElement WDSElement;
  487.  
  488. struct NTElement {
  489.     AddrBlock                         nteAddress;                    /*network address of entity*/
  490.     SInt8                             filler;
  491.     SInt8                             entityData[99];                /*Object, Type & Zone*/
  492. };
  493. typedef struct NTElement NTElement;
  494.  
  495. struct NamesTableEntry {
  496.     Ptr                             qNext;                        /*ptr to next NTE*/
  497.     NTElement                         nt;
  498. };
  499. typedef struct NamesTableEntry NamesTableEntry;
  500.  
  501. typedef CALLBACK_API( Boolean , MPPProtocolHandlerProcPtr )(Ptr SCCAddr1, Ptr SCCAddr2, Ptr MPPLocalVars, Ptr nextFreeByteInRHA, Ptr ReadPacketAndReadRestPtr, short numBytesLeftToReadInPacket);
  502. /*
  503.     WARNING: MPPProtocolHandlerProcPtr uses register based parameters under classic 68k
  504.              and cannot be written in a high-level language without 
  505.              the help of mixed mode or assembly glue.
  506. */
  507. typedef CALLBACK_API( Boolean , DDPSocketListenerProcPtr )(Ptr SCCAddr1, Ptr SCCAddr2, Ptr MPPLocalVars, Ptr nextFreeByteInRHA, Ptr ReadPacketAndReadRestPtr, UInt8 packetDestinationNumber, short numBytesLeftToReadInPacket);
  508. /*
  509.     WARNING: DDPSocketListenerProcPtr uses register based parameters under classic 68k
  510.              and cannot be written in a high-level language without 
  511.              the help of mixed mode or assembly glue.
  512. */
  513. typedef REGISTER_UPP_TYPE(MPPProtocolHandlerProcPtr)             MPPProtocolHandlerUPP;
  514. typedef REGISTER_UPP_TYPE(DDPSocketListenerProcPtr)             DDPSocketListenerUPP;
  515. /*
  516.     MPPProtocolHandlerProcs and  DDPSocketListenerProcs cannot be written 
  517.     in or called from a high-level language without the help of mixed mode 
  518.     or assembly glue because they use the following parameter-passing conventions:
  519.  
  520.     typedef Boolean (*MPPProtocolHandlerProcPtr)(Ptr SCCAddr1, Ptr SCCAddr2, 
  521.             Ptr MPPLocalVars, Ptr nextFreeByteInRHA, Ptr ReadPacketAndReadRestPtr, 
  522.             short numBytesLeftToReadInPacket);
  523.  
  524.         In:
  525.             =>    SCCAddr1                    A0.L
  526.             =>    SCCAddr2                    A1.L
  527.             =>    MPPLocalVars                A2.L
  528.             =>    nextFreeByteInRHA            A3.L
  529.             =>    ReadPacketAndReadRestPtr    A4.L
  530.             =>    numBytesLeftToReadInPacket    D1.W
  531.         Out:
  532.             <=    Boolean                        Z bit of CCR
  533.  
  534.     typedef Boolean (*DDPSocketListenerProcPtr)(Ptr SCCAddr1, Ptr SCCAddr2, 
  535.             Ptr MPPLocalVars, Ptr nextFreeByteInRHA, Ptr ReadPacketAndReadRestPtr, 
  536.             UInt8 packetDestinationNumber, short numBytesLeftToReadInPacket);
  537.  
  538.         In:
  539.             =>    SCCAddr1                    A0.L
  540.             =>    SCCAddr2                    A1.L
  541.             =>    MPPLocalVars                A2.L
  542.             =>    nextFreeByteInRHA            A3.L
  543.             =>    ReadPacketAndReadRestPtr    A4.L
  544.             =>    packetDestinationNumber        D0.B
  545.             =>    numBytesLeftToReadInPacket    D1.W
  546.         Out:
  547.             <=    Boolean                        Z bit of CCR
  548.  
  549. */
  550. struct MPPparms {
  551.     QElem *                            qLink;                        /*next queue entry*/
  552.     short                             qType;                        /*queue type*/
  553.     short                             ioTrap;                        /*routine trap*/
  554.     Ptr                             ioCmdAddr;                    /*routine address*/
  555.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  556.     OSErr                             ioResult;                    /*result code*/
  557.     long                             userData;                    /*Command result (ATP user bytes)*/
  558.     short                             reqTID;                        /*request transaction ID*/
  559.     short                             ioRefNum;                    /*driver reference number*/
  560.     short                             csCode;                        /*Call command code*/
  561. };
  562. typedef struct MPPparms MPPparms;
  563.  
  564. struct LAPparms {
  565.     QElem *                            qLink;                        /*next queue entry*/
  566.     short                             qType;                        /*queue type*/
  567.     short                             ioTrap;                        /*routine trap*/
  568.     Ptr                             ioCmdAddr;                    /*routine address*/
  569.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  570.     OSErr                             ioResult;                    /*result code*/
  571.     long                             userData;                    /*Command result (ATP user bytes)*/
  572.     short                             reqTID;                        /*request transaction ID*/
  573.     short                             ioRefNum;                    /*driver reference number*/
  574.     short                             csCode;                        /*Call command code*/
  575.     UInt8                             protType;                    /*ALAP protocol Type */
  576.     UInt8                             filler;
  577.     union {
  578.         void *                            wdsPointer;                /*-> write data structure*/
  579.         MPPProtocolHandlerUPP             handler;                /*-> protocol handler routine*/
  580.     }                                 u;
  581. };
  582. typedef struct LAPparms LAPparms;
  583.  
  584. struct DDPparms {
  585.     QElem *                            qLink;                        /*next queue entry*/
  586.     short                             qType;                        /*queue type*/
  587.     short                             ioTrap;                        /*routine trap*/
  588.     Ptr                             ioCmdAddr;                    /*routine address*/
  589.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  590.     OSErr                             ioResult;                    /*result code*/
  591.     long                             userData;                    /*Command result (ATP user bytes)*/
  592.     short                             reqTID;                        /*request transaction ID*/
  593.     short                             ioRefNum;                    /*driver reference number*/
  594.     short                             csCode;                        /*Call command code*/
  595.     UInt8                             socket;                        /*socket number */
  596.     UInt8                             checksumFlag;                /*check sum flag */
  597.     union {
  598.         void *                            wdsPointer;                /*-> write data structure*/
  599.         DDPSocketListenerUPP             listener;                /*->write data structure or -> Listener*/
  600.     }                                 u;
  601. };
  602. typedef struct DDPparms DDPparms;
  603.  
  604. union NBPPtrs {
  605.     Ptr                             ntQElPtr;
  606.     Ptr                             entityPtr;
  607. };
  608. typedef union NBPPtrs NBPPtrs;
  609.  
  610. union LookupConfirmParams {
  611.     UInt8                             verifyFlag;
  612.     struct {
  613.         void *                            retBuffPtr;
  614.         short                             retBuffSize;
  615.         short                             maxToGet;
  616.         short                             numGotten;
  617.     }                                 Lookup;
  618.     struct {
  619.         AddrBlock                         confirmAddr;
  620.         UInt8                             newSocket;
  621.         SInt8                             filler;                    /*    Filler for proper byte alignment*/
  622.     }                                 Confirm;
  623. };
  624. typedef union LookupConfirmParams LookupConfirmParams;
  625.  
  626. struct NBPparms {
  627.     QElem *                            qLink;                        /*next queue entry*/
  628.     short                             qType;                        /*queue type*/
  629.     short                             ioTrap;                        /*routine trap*/
  630.     Ptr                             ioCmdAddr;                    /*routine address*/
  631.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  632.     OSErr                             ioResult;                    /*result code*/
  633.     long                             userData;                    /*Command result (ATP user bytes)*/
  634.     short                             reqTID;                        /*request transaction ID*/
  635.     short                             ioRefNum;                    /*driver reference number*/
  636.     short                             csCode;                        /*Call command code*/
  637.     UInt8                             interval;                    /*retry interval */
  638.     UInt8                             count;                        /*retry count */
  639.     NBPPtrs                         nbpPtrs;
  640.     LookupConfirmParams             parm;
  641. };
  642. typedef struct NBPparms NBPparms;
  643.  
  644. struct SetSelfparms {
  645.     QElem *                            qLink;                        /*next queue entry*/
  646.     short                             qType;                        /*queue type*/
  647.     short                             ioTrap;                        /*routine trap*/
  648.     Ptr                             ioCmdAddr;                    /*routine address*/
  649.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  650.     OSErr                             ioResult;                    /*result code*/
  651.     long                             userData;                    /*Command result (ATP user bytes)*/
  652.     short                             reqTID;                        /*request transaction ID*/
  653.     short                             ioRefNum;                    /*driver reference number*/
  654.     short                             csCode;                        /*Call command code*/
  655.     UInt8                             newSelfFlag;                /*self-send toggle flag */
  656.     UInt8                             oldSelfFlag;                /*previous self-send state */
  657. };
  658. typedef struct SetSelfparms SetSelfparms;
  659.  
  660. struct NBPKillparms {
  661.     QElem *                            qLink;                        /*next queue entry*/
  662.     short                             qType;                        /*queue type*/
  663.     short                             ioTrap;                        /*routine trap*/
  664.     Ptr                             ioCmdAddr;                    /*routine address*/
  665.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  666.     OSErr                             ioResult;                    /*result code*/
  667.     long                             userData;                    /*Command result (ATP user bytes)*/
  668.     short                             reqTID;                        /*request transaction ID*/
  669.     short                             ioRefNum;                    /*driver reference number*/
  670.     short                             csCode;                        /*Call command code*/
  671.     void *                            nKillQEl;                    /*ptr to i/o queue element to cancel */
  672. };
  673. typedef struct NBPKillparms NBPKillparms;
  674.  
  675.  
  676. struct GetAppleTalkInfoParm {
  677.     QElem *                            qLink;                        /*next queue entry*/
  678.     short                             qType;                        /*queue type*/
  679.     short                             ioTrap;                        /*routine trap*/
  680.     Ptr                             ioCmdAddr;                    /*routine address*/
  681.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  682.     OSErr                             ioResult;                    /*result code*/
  683.     long                             userData;                    /*Command result (ATP user bytes)*/
  684.     short                             reqTID;                        /*request transaction ID*/
  685.     short                             ioRefNum;                    /*driver reference number*/
  686.     short                             csCode;                        /*Call command code*/
  687.                                                                 /*max. concurrent NBP requests*/
  688.     short                             version;                    /*requested info version*/
  689.     void *                            varsPtr;                    /*pointer to well known MPP vars*/
  690.     void *                            DCEPtr;                        /*pointer to MPP DCE*/
  691.     short                             portID;                        /*port number [0..7]*/
  692.     long                             configuration;                /*32-bit configuration word*/
  693.     short                             selfSend;                    /*non zero if SelfSend enabled*/
  694.     short                             netLo;                        /*low value of network range*/
  695.     short                             netHi;                        /*high value of network range*/
  696.     long                             ourAdd;                        /*our 24-bit AppleTalk address*/
  697.     long                             routerAddr;                    /*24-bit address of (last) router*/
  698.     short                             numOfPHs;                    /*max. number of protocol handlers*/
  699.     short                             numOfSkts;                    /*max. number of static sockets*/
  700.     short                             numNBPEs;                    /*max. concurrent NBP requests*/
  701.     void *                            nTQueue;                    /*pointer to registered name queue*/
  702.     short                             LAlength;                    /*length in bytes of data link addr*/
  703.     void *                            linkAddr;                    /*data link address returned*/
  704.     Ptr                             zoneName;                    /*zone name returned*/
  705. };
  706. typedef struct GetAppleTalkInfoParm GetAppleTalkInfoParm;
  707.  
  708. struct ATalkClosePrepParm {
  709.     QElem *                            qLink;                        /*next queue entry*/
  710.     short                             qType;                        /*queue type*/
  711.     short                             ioTrap;                        /*routine trap*/
  712.     Ptr                             ioCmdAddr;                    /*routine address*/
  713.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  714.     OSErr                             ioResult;                    /*result code*/
  715.     long                             userData;                    /*Command result (ATP user bytes)*/
  716.     short                             reqTID;                        /*request transaction ID*/
  717.     short                             ioRefNum;                    /*driver reference number*/
  718.     short                             csCode;                        /*Call command code*/
  719.     Ptr                             appName;                    /*pointer to application name in buffer*/
  720. };
  721. typedef struct ATalkClosePrepParm ATalkClosePrepParm;
  722.  
  723. union MPPParamBlock {
  724.     MPPparms                         MPP;                        /*General MPP parms*/
  725.     LAPparms                         LAP;                        /*ALAP calls*/
  726.     DDPparms                         DDP;                        /*DDP calls*/
  727.     NBPparms                         NBP;                        /*NBP calls*/
  728.     SetSelfparms                     SETSELF;
  729.     NBPKillparms                     NBPKILL;
  730.     GetAppleTalkInfoParm             GAIINFO;
  731.     ATalkClosePrepParm                 ATALKCLOSE;
  732. };
  733.  
  734.  
  735. struct XPPPrmBlk {
  736.     QElem *                            qLink;
  737.     short                             qType;
  738.     short                             ioTrap;
  739.     Ptr                             ioCmdAddr;
  740.     XPPCompletionUPP                 ioCompletion;
  741.     OSErr                             ioResult;
  742.     long                             cmdResult;
  743.     short                             ioVRefNum;
  744.     short                             ioRefNum;
  745.     short                             csCode;
  746.     short                             sessRefnum;                    /*Offset to session refnum */
  747.     UInt8                             aspTimeout;                    /*Timeout for ATP */
  748.     UInt8                             aspRetry;                    /*Retry count for ATP */
  749.     short                             cbSize;                        /*Command block size */
  750.     Ptr                             cbPtr;                        /*Command block pointer */
  751.     short                             rbSize;                        /*Reply buffer size */
  752.     Ptr                             rbPtr;                        /*Reply buffer pointer */
  753.     short                             wdSize;                        /*Write Data size*/
  754.     Ptr                             wdPtr;                        /*Write Data pointer*/
  755.     UInt8                             ccbStart[296];                /*CCB memory allocated for driver afpWrite max size(CCB)=296 all other calls=150*/
  756. };
  757. typedef struct XPPPrmBlk XPPPrmBlk;
  758.  
  759. struct ASPGetparmsBlk {
  760.     QElem *                            qLink;
  761.     short                             qType;
  762.     short                             ioTrap;
  763.     Ptr                             ioCmdAddr;
  764.     XPPCompletionUPP                 ioCompletion;
  765.     OSErr                             ioResult;
  766.     long                             cmdResult;
  767.     short                             ioVRefNum;
  768.     short                             ioRefNum;
  769.     short                             csCode;
  770.     short                             aspMaxCmdSize;                /*For SPGetParms*/
  771.     short                             aspQuantumSize;
  772.     short                             numSesss;
  773. };
  774. typedef struct ASPGetparmsBlk ASPGetparmsBlk;
  775.  
  776. struct ASPAbortPrm {
  777.     QElem *                            qLink;
  778.     short                             qType;
  779.     short                             ioTrap;
  780.     Ptr                             ioCmdAddr;
  781.     XPPCompletionUPP                 ioCompletion;
  782.     OSErr                             ioResult;
  783.     long                             cmdResult;
  784.     short                             ioVRefNum;
  785.     short                             ioRefNum;
  786.     short                             csCode;
  787.     Ptr                             abortSCBPtr;                /*SCB pointer for AbortOS */
  788. };
  789. typedef struct ASPAbortPrm ASPAbortPrm;
  790.  
  791. struct ASPOpenPrm {
  792.     QElem *                            qLink;
  793.     short                             qType;
  794.     short                             ioTrap;
  795.     Ptr                             ioCmdAddr;
  796.     XPPCompletionUPP                 ioCompletion;
  797.     OSErr                             ioResult;
  798.     long                             cmdResult;
  799.     short                             ioVRefNum;
  800.     short                             ioRefNum;
  801.     short                             csCode;
  802.     short                             sessRefnum;                    /*Offset to session refnum */
  803.     UInt8                             aspTimeout;                    /*Timeout for ATP */
  804.     UInt8                             aspRetry;                    /*Retry count for ATP */
  805.     AddrBlock                         serverAddr;                    /*Server address block */
  806.     Ptr                             scbPointer;                    /*SCB pointer */
  807.     AttnRoutineUPP                     attnRoutine;                /*Attention routine pointer*/
  808. };
  809. typedef struct ASPOpenPrm ASPOpenPrm;
  810.  
  811. typedef ASPOpenPrm *                    ASPOpenPrmPtr;
  812. struct AFPLoginPrm {
  813.     QElem *                            qLink;
  814.     short                             qType;
  815.     short                             ioTrap;
  816.     Ptr                             ioCmdAddr;
  817.     XPPCompletionUPP                 ioCompletion;
  818.     OSErr                             ioResult;
  819.     long                             cmdResult;
  820.     short                             ioVRefNum;
  821.     short                             ioRefNum;
  822.     short                             csCode;
  823.     short                             sessRefnum;                    /*Offset to session refnum */
  824.     UInt8                             aspTimeout;                    /*Timeout for ATP */
  825.     UInt8                             aspRetry;                    /*Retry count for ATP */
  826.     short                             cbSize;                        /*Command block size */
  827.     void *                            cbPtr;                        /*Command block pointer */
  828.     short                             rbSize;                        /*Reply buffer size */
  829.     void *                            rbPtr;                        /*Reply buffer pointer */
  830.     AddrBlock                         afpAddrBlock;                /*block in AFP login */
  831.     void *                            afpSCBPtr;                    /*SCB pointer in AFP login */
  832.     AttnRoutineUPP                     afpAttnRoutine;                /*routine pointer in AFP login */
  833.     UInt8                             ccbFill[144];                /*CCB memory allocated for driver  Login needs only 150 bytes BUT CCB really starts in the middle of AFPSCBPtr and also clobbers AFPAttnRoutine. */
  834. };
  835. typedef struct AFPLoginPrm AFPLoginPrm;
  836.  
  837. struct XCallParam {
  838.     QElem *                            qLink;
  839.     short                             qType;
  840.     short                             ioTrap;
  841.     Ptr                             ioCmdAddr;
  842.     XPPCompletionUPP                 ioCompletion;
  843.     OSErr                             ioResult;
  844.     long                             cmdResult;
  845.     short                             ioVRefNum;
  846.     short                             ioRefNum;
  847.     short                             csCode;
  848.     short                             xppSubCode;
  849.     UInt8                             xppTimeout;                    /*retry interval (seconds)*/
  850.     UInt8                             xppRetry;                    /*retry count*/
  851.     short                             filler1;
  852.     void *                            zipBuffPtr;                    /*pointer to buffer (must be 578 bytes)*/
  853.     short                             zipNumZones;                /*no. of zone names in this response*/
  854.     UInt8                             zipLastFlag;                /*non-zero if no more zones*/
  855.     UInt8                             filler2;                    /*filler*/
  856.     UInt8                             zipInfoField[70];            /*on initial call, set first word to zero*/
  857. };
  858. typedef struct XCallParam XCallParam;
  859.  
  860. union XPPParamBlock {
  861.     XPPPrmBlk                         XPP;
  862.     ASPGetparmsBlk                     GETPARM;
  863.     ASPAbortPrm                     ABORT;
  864.     ASPOpenPrm                         OPEN;
  865.     AFPLoginPrm                     LOGIN;
  866.     XCallParam                         XCALL;
  867. };
  868.  
  869. struct ATPparms {
  870.     QElem *                            qLink;                        /*next queue entry*/
  871.     short                             qType;                        /*queue type*/
  872.     short                             ioTrap;                        /*routine trap*/
  873.     Ptr                             ioCmdAddr;                    /*routine address*/
  874.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  875.     OSErr                             ioResult;                    /*result code*/
  876.     long                             userData;                    /*Command result (ATP user bytes)*/
  877.     short                             reqTID;                        /*request transaction ID*/
  878.     short                             ioRefNum;                    /*driver reference number*/
  879.     short                             csCode;                        /*Call command code*/
  880.     UInt8                             atpSocket;                    /*currbitmap for requests or ATP socket number*/
  881.     UInt8                             atpFlags;                    /*control information*/
  882.     AddrBlock                         addrBlock;                    /*source/dest. socket address*/
  883.     short                             reqLength;                    /*request/response length*/
  884.     void *                            reqPointer;                    /*->request/response Data*/
  885.     void *                            bdsPointer;                    /*->response BDS */
  886. };
  887. typedef struct ATPparms ATPparms;
  888.  
  889. struct SendReqparms {
  890.     QElem *                            qLink;                        /*next queue entry*/
  891.     short                             qType;                        /*queue type*/
  892.     short                             ioTrap;                        /*routine trap*/
  893.     Ptr                             ioCmdAddr;                    /*routine address*/
  894.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  895.     OSErr                             ioResult;                    /*result code*/
  896.     long                             userData;                    /*Command result (ATP user bytes)*/
  897.     short                             reqTID;                        /*request transaction ID*/
  898.     short                             ioRefNum;                    /*driver reference number*/
  899.     short                             csCode;                        /*Call command code*/
  900.     UInt8                             atpSocket;                    /*currbitmap for requests or ATP socket number*/
  901.     UInt8                             atpFlags;                    /*control information*/
  902.     AddrBlock                         addrBlock;                    /*source/dest. socket address*/
  903.     short                             reqLength;                    /*request/response length*/
  904.     void *                            reqPointer;                    /*->request/response Data*/
  905.     void *                            bdsPointer;                    /*->response BDS */
  906.     UInt8                             numOfBuffs;                    /*numOfBuffs */
  907.     UInt8                             timeOutVal;                    /*timeout interval */
  908.     UInt8                             numOfResps;                    /*number of responses actually received */
  909.     UInt8                             retryCount;                    /*number of retries */
  910.     short                             intBuff;                    /*used internally for NSendRequest */
  911.     UInt8                             TRelTime;                    /*TRelease time for extended send request */
  912.     SInt8                             filler0;
  913. };
  914. typedef struct SendReqparms SendReqparms;
  915.  
  916.  
  917. struct ATPmisc1 {
  918.     QElem *                            qLink;                        /*next queue entry*/
  919.     short                             qType;                        /*queue type*/
  920.     short                             ioTrap;                        /*routine trap*/
  921.     Ptr                             ioCmdAddr;                    /*routine address*/
  922.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  923.     OSErr                             ioResult;                    /*result code*/
  924.     long                             userData;                    /*Command result (ATP user bytes)*/
  925.     short                             reqTID;                        /*request transaction ID*/
  926.     short                             ioRefNum;                    /*driver reference number*/
  927.     short                             csCode;                        /*Call command code*/
  928.     UInt8                             atpSocket;                    /*currbitmap for requests or ATP socket number*/
  929.     UInt8                             atpFlags;                    /*control information*/
  930.     AddrBlock                         addrBlock;                    /*source/dest. socket address*/
  931.     short                             reqLength;                    /*request/response length*/
  932.     void *                            reqPointer;                    /*->request/response Data*/
  933.     void *                            bdsPointer;                    /*->response BDS */
  934.     union {
  935.         UInt8                             bitMap;                    /*bitmap received */
  936.         UInt8                             numOfBuffs;                /*number of responses being sent*/
  937.         UInt8                             rspNum;                    /*sequence number*/
  938.     }                                 u;
  939. };
  940. typedef struct ATPmisc1 ATPmisc1;
  941.  
  942. struct ATPmisc2 {
  943.     QElem *                            qLink;                        /*next queue entry*/
  944.     short                             qType;                        /*queue type*/
  945.     short                             ioTrap;                        /*routine trap*/
  946.     Ptr                             ioCmdAddr;                    /*routine address*/
  947.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  948.     OSErr                             ioResult;                    /*result code*/
  949.     long                             userData;                    /*Command result (ATP user bytes)*/
  950.     short                             reqTID;                        /*request transaction ID*/
  951.     short                             ioRefNum;                    /*driver reference number*/
  952.     short                             csCode;                        /*Call command code*/
  953.     UInt8                             atpSocket;                    /*currbitmap for requests or ATP socket number*/
  954.     UInt8                             atpFlags;                    /*control information*/
  955.     AddrBlock                         addrBlock;                    /*source/dest. socket address*/
  956.     short                             reqLength;                    /*request/response length*/
  957.     void *                            reqPointer;                    /*->request/response Data*/
  958.     void *                            bdsPointer;                    /*->response BDS */
  959.     UInt8                             filler;
  960.     UInt8                             bdsSize;                    /*number of BDS elements */
  961.     short                             transID;                    /*transaction ID recd. */
  962. };
  963. typedef struct ATPmisc2 ATPmisc2;
  964.  
  965. struct Killparms {
  966.     QElem *                            qLink;                        /*next queue entry*/
  967.     short                             qType;                        /*queue type*/
  968.     short                             ioTrap;                        /*routine trap*/
  969.     Ptr                             ioCmdAddr;                    /*routine address*/
  970.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  971.     OSErr                             ioResult;                    /*result code*/
  972.     long                             userData;                    /*Command result (ATP user bytes)*/
  973.     short                             reqTID;                        /*request transaction ID*/
  974.     short                             ioRefNum;                    /*driver reference number*/
  975.     short                             csCode;                        /*Call command code*/
  976.     UInt8                             atpSocket;                    /*currbitmap for requests or ATP socket number*/
  977.     UInt8                             atpFlags;                    /*control information*/
  978.     AddrBlock                         addrBlock;                    /*source/dest. socket address*/
  979.     short                             reqLength;                    /*request/response length*/
  980.     void *                            reqPointer;                    /*->request/response Data*/
  981.     void *                            bdsPointer;                    /*->response BDS */
  982.     void *                            aKillQEl;                    /*ptr to i/o queue element to cancel*/
  983. };
  984. typedef struct Killparms Killparms;
  985.  
  986. union ATPParamBlock {
  987.     ATPparms                         ATP;                        /*General ATP parms*/
  988.     SendReqparms                     SREQ;                        /*sendrequest parms*/
  989.     ATPmisc1                         OTH1;                        /*and a few others*/
  990.     ATPmisc2                         OTH2;                        /*and a few others*/
  991.     Killparms                         KILL;                        /*and a few others*/
  992. };
  993.  
  994. enum { uppATalkTransitionEventProcInfo = 0x00000FF1 };             /* 4_bytes Func(4_bytes, 4_bytes, 4_bytes) */
  995. enum { uppMPPCompletionProcInfo = 0x00009802 };                 /* register no_return_value Func(4_bytes:A0) */
  996. enum { uppATPCompletionProcInfo = 0x00009802 };                 /* register no_return_value Func(4_bytes:A0) */
  997. enum { uppXPPCompletionProcInfo = 0x00009802 };                 /* register no_return_value Func(4_bytes:A0) */
  998. enum { uppAttnRoutineProcInfo = 0x00061002 };                     /* register no_return_value Func(2_bytes:D0, 2_bytes:D1) */
  999. enum { uppMPPProtocolHandlerProcInfo = 0x0000007F };             /* SPECIAL_CASE_PROCINFO(7) */
  1000. enum { uppDDPSocketListenerProcInfo = 0x0000008F };             /* SPECIAL_CASE_PROCINFO(8) */
  1001. #define NewATalkTransitionEventProc(userRoutine)                 (ATalkTransitionEventUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppATalkTransitionEventProcInfo, GetCurrentArchitecture())
  1002. #define NewMPPCompletionProc(userRoutine)                         (MPPCompletionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMPPCompletionProcInfo, GetCurrentArchitecture())
  1003. #define NewATPCompletionProc(userRoutine)                         (ATPCompletionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppATPCompletionProcInfo, GetCurrentArchitecture())
  1004. #define NewXPPCompletionProc(userRoutine)                         (XPPCompletionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppXPPCompletionProcInfo, GetCurrentArchitecture())
  1005. #define NewAttnRoutineProc(userRoutine)                         (AttnRoutineUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppAttnRoutineProcInfo, GetCurrentArchitecture())
  1006. #define NewMPPProtocolHandlerProc(userRoutine)                     (MPPProtocolHandlerUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMPPProtocolHandlerProcInfo, GetCurrentArchitecture())
  1007. #define NewDDPSocketListenerProc(userRoutine)                     (DDPSocketListenerUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppDDPSocketListenerProcInfo, GetCurrentArchitecture())
  1008. #define CallATalkTransitionEventProc(userRoutine, eventCode, qElem, eventParameter)  CALL_THREE_PARAMETER_UPP((userRoutine), uppATalkTransitionEventProcInfo, (eventCode), (qElem), (eventParameter))
  1009. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1010.     #pragma parameter CallMPPCompletionProc(__A1, __A0)
  1011.     void CallMPPCompletionProc(MPPCompletionUPP routine, MPPPBPtr thePBptr) = 0x4E91;
  1012. #else
  1013.     #define CallMPPCompletionProc(userRoutine, thePBptr)         CALL_ONE_PARAMETER_UPP((userRoutine), uppMPPCompletionProcInfo, (thePBptr))
  1014. #endif
  1015. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1016.     #pragma parameter CallATPCompletionProc(__A1, __A0)
  1017.     void CallATPCompletionProc(ATPCompletionUPP routine, ATPPBPtr thePBptr) = 0x4E91;
  1018. #else
  1019.     #define CallATPCompletionProc(userRoutine, thePBptr)         CALL_ONE_PARAMETER_UPP((userRoutine), uppATPCompletionProcInfo, (thePBptr))
  1020. #endif
  1021. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1022.     #pragma parameter CallXPPCompletionProc(__A1, __A0)
  1023.     void CallXPPCompletionProc(XPPCompletionUPP routine, XPPParmBlkPtr thePBptr) = 0x4E91;
  1024. #else
  1025.     #define CallXPPCompletionProc(userRoutine, thePBptr)         CALL_ONE_PARAMETER_UPP((userRoutine), uppXPPCompletionProcInfo, (thePBptr))
  1026. #endif
  1027. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1028.     #pragma parameter CallAttnRoutineProc(__A0, __D0, __D1)
  1029.     void CallAttnRoutineProc(AttnRoutineUPP routine, short sessRefnum, short attnBytes) = 0x4E90;
  1030. #else
  1031.     #define CallAttnRoutineProc(userRoutine, sessRefnum, attnBytes)  CALL_TWO_PARAMETER_UPP((userRoutine), uppAttnRoutineProcInfo, (sessRefnum), (attnBytes))
  1032. #endif
  1033. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1034.     /* CallMPPProtocolHandlerProc can't be called from classic 68k without glue code */
  1035. #else
  1036.     #define CallMPPProtocolHandlerProc(userRoutine, SCCAddr1, SCCAddr2, MPPLocalVars, nextFreeByteInRHA, ReadPacketAndReadRestPtr, numBytesLeftToReadInPacket)  CALL_SIX_PARAMETER_UPP((userRoutine), uppMPPProtocolHandlerProcInfo, (SCCAddr1), (SCCAddr2), (MPPLocalVars), (nextFreeByteInRHA), (ReadPacketAndReadRestPtr), (numBytesLeftToReadInPacket))
  1037. #endif
  1038. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1039.     /* CallDDPSocketListenerProc can't be called from classic 68k without glue code */
  1040. #else
  1041.     #define CallDDPSocketListenerProc(userRoutine, SCCAddr1, SCCAddr2, MPPLocalVars, nextFreeByteInRHA, ReadPacketAndReadRestPtr, packetDestinationNumber, numBytesLeftToReadInPacket)  CALL_SEVEN_PARAMETER_UPP((userRoutine), uppDDPSocketListenerProcInfo, (SCCAddr1), (SCCAddr2), (MPPLocalVars), (nextFreeByteInRHA), (ReadPacketAndReadRestPtr), (packetDestinationNumber), (numBytesLeftToReadInPacket))
  1042. #endif
  1043. EXTERN_API( OSErr )
  1044. OpenXPP                            (short *                xppRefnum);
  1045.  
  1046. EXTERN_API( OSErr )
  1047. ASPOpenSession                    (XPPParmBlkPtr             thePBptr,
  1048.                                  Boolean                 async);
  1049.  
  1050. EXTERN_API( OSErr )
  1051. ASPCloseSession                    (XPPParmBlkPtr             thePBptr,
  1052.                                  Boolean                 async);
  1053.  
  1054. EXTERN_API( OSErr )
  1055. ASPAbortOS                        (XPPParmBlkPtr             thePBptr,
  1056.                                  Boolean                 async);
  1057.  
  1058. EXTERN_API( OSErr )
  1059. ASPGetParms                        (XPPParmBlkPtr             thePBptr,
  1060.                                  Boolean                 async);
  1061.  
  1062. EXTERN_API( OSErr )
  1063. ASPCloseAll                        (XPPParmBlkPtr             thePBptr,
  1064.                                  Boolean                 async);
  1065.  
  1066. EXTERN_API( OSErr )
  1067. ASPUserWrite                    (XPPParmBlkPtr             thePBptr,
  1068.                                  Boolean                 async);
  1069.  
  1070. EXTERN_API( OSErr )
  1071. ASPUserCommand                    (XPPParmBlkPtr             thePBptr,
  1072.                                  Boolean                 async);
  1073.  
  1074. EXTERN_API( OSErr )
  1075. ASPGetStatus                    (XPPParmBlkPtr             thePBptr,
  1076.                                  Boolean                 async);
  1077.  
  1078. #define ASPGetStatusSync(paramBlock) ASPGetStatus((paramBlock), false)
  1079. EXTERN_API( OSErr )
  1080. AFPCommand                        (XPPParmBlkPtr             thePBptr,
  1081.                                  Boolean                 async);
  1082.  
  1083. EXTERN_API( OSErr )
  1084. GetLocalZones                    (XPPParmBlkPtr             thePBptr,
  1085.                                  Boolean                 async);
  1086.  
  1087. EXTERN_API( OSErr )
  1088. GetZoneList                        (XPPParmBlkPtr             thePBptr,
  1089.                                  Boolean                 async);
  1090.  
  1091. EXTERN_API( OSErr )
  1092. GetMyZone                        (XPPParmBlkPtr             thePBptr,
  1093.                                  Boolean                 async);
  1094.  
  1095. EXTERN_API( OSErr )
  1096. PAttachPH                        (MPPPBPtr                 thePBptr,
  1097.                                  Boolean                 async);
  1098.  
  1099. EXTERN_API( OSErr )
  1100. PDetachPH                        (MPPPBPtr                 thePBptr,
  1101.                                  Boolean                 async);
  1102.  
  1103. EXTERN_API( OSErr )
  1104. PWriteLAP                        (MPPPBPtr                 thePBptr,
  1105.                                  Boolean                 async);
  1106.  
  1107. EXTERN_API( OSErr )
  1108. POpenSkt                        (MPPPBPtr                 thePBptr,
  1109.                                  Boolean                 async);
  1110.  
  1111. EXTERN_API( OSErr )
  1112. PCloseSkt                        (MPPPBPtr                 thePBptr,
  1113.                                  Boolean                 async);
  1114.  
  1115. EXTERN_API( OSErr )
  1116. PWriteDDP                        (MPPPBPtr                 thePBptr,
  1117.                                  Boolean                 async);
  1118.  
  1119. EXTERN_API( OSErr )
  1120. PRegisterName                    (MPPPBPtr                 thePBptr,
  1121.                                  Boolean                 async);
  1122.  
  1123. EXTERN_API( OSErr )
  1124. PLookupName                        (MPPPBPtr                 thePBptr,
  1125.                                  Boolean                 async);
  1126.  
  1127. #define PLookupNameSync(paramBlock) PLookupName((paramBlock), false)
  1128. EXTERN_API( OSErr )
  1129. PConfirmName                    (MPPPBPtr                 thePBptr,
  1130.                                  Boolean                 async);
  1131.  
  1132. EXTERN_API( OSErr )
  1133. PRemoveName                        (MPPPBPtr                 thePBptr,
  1134.                                  Boolean                 async);
  1135.  
  1136. EXTERN_API( OSErr )
  1137. PSetSelfSend                    (MPPPBPtr                 thePBptr,
  1138.                                  Boolean                 async);
  1139.  
  1140. EXTERN_API( OSErr )
  1141. PKillNBP                        (MPPPBPtr                 thePBptr,
  1142.                                  Boolean                 async);
  1143.  
  1144. EXTERN_API( OSErr )
  1145. PGetAppleTalkInfo                (MPPPBPtr                 thePBptr,
  1146.                                  Boolean                 async);
  1147.  
  1148. EXTERN_API( OSErr )
  1149. PATalkClosePrep                    (MPPPBPtr                 thePBptr,
  1150.                                  Boolean                 async);
  1151.  
  1152. EXTERN_API( OSErr )
  1153. POpenATPSkt                        (ATPPBPtr                 thePBptr,
  1154.                                  Boolean                 async);
  1155.  
  1156. EXTERN_API( OSErr )
  1157. PCloseATPSkt                    (ATPPBPtr                 thePBPtr,
  1158.                                  Boolean                 async);
  1159.  
  1160. EXTERN_API( OSErr )
  1161. PSendRequest                    (ATPPBPtr                 thePBPtr,
  1162.                                  Boolean                 async);
  1163.  
  1164. EXTERN_API( OSErr )
  1165. PGetRequest                        (ATPPBPtr                 thePBPtr,
  1166.                                  Boolean                 async);
  1167.  
  1168. EXTERN_API( OSErr )
  1169. PSendResponse                    (ATPPBPtr                 thePBPtr,
  1170.                                  Boolean                 async);
  1171.  
  1172. EXTERN_API( OSErr )
  1173. PAddResponse                    (ATPPBPtr                 thePBPtr,
  1174.                                  Boolean                 async);
  1175.  
  1176. EXTERN_API( OSErr )
  1177. PRelTCB                            (ATPPBPtr                 thePBPtr,
  1178.                                  Boolean                 async);
  1179.  
  1180. EXTERN_API( OSErr )
  1181. PRelRspCB                        (ATPPBPtr                 thePBPtr,
  1182.                                  Boolean                 async);
  1183.  
  1184. EXTERN_API( OSErr )
  1185. PNSendRequest                    (ATPPBPtr                 thePBPtr,
  1186.                                  Boolean                 async);
  1187.  
  1188. EXTERN_API( OSErr )
  1189. PKillSendReq                    (ATPPBPtr                 thePBPtr,
  1190.                                  Boolean                 async);
  1191.  
  1192. EXTERN_API( OSErr )
  1193. PKillGetReq                        (ATPPBPtr                 thePBPtr,
  1194.                                  Boolean                 async);
  1195.  
  1196. EXTERN_API( OSErr )
  1197. ATPKillAllGetReq                (ATPPBPtr                 thePBPtr,
  1198.                                  Boolean                 async);
  1199.  
  1200. EXTERN_API( void )
  1201. BuildLAPwds                        (Ptr                     wdsPtr,
  1202.                                  Ptr                     dataPtr,
  1203.                                  short                     destHost,
  1204.                                  short                     prototype,
  1205.                                  short                     frameLen);
  1206.  
  1207. EXTERN_API( void )
  1208. BuildDDPwds                        (Ptr                     wdsPtr,
  1209.                                  Ptr                     headerPtr,
  1210.                                  Ptr                     dataPtr,
  1211.                                  AddrBlock                 netAddr,
  1212.                                  short                     ddpType,
  1213.                                  short                     dataLen);
  1214.  
  1215. EXTERN_API( void )
  1216. NBPSetEntity                    (Ptr                     buffer,
  1217.                                  ConstStr32Param         nbpObject,
  1218.                                  ConstStr32Param         nbpType,
  1219.                                  ConstStr32Param         nbpZone);
  1220.  
  1221. EXTERN_API( void )
  1222. NBPSetNTE                        (Ptr                     ntePtr,
  1223.                                  ConstStr32Param         nbpObject,
  1224.                                  ConstStr32Param         nbpType,
  1225.                                  ConstStr32Param         nbpZone,
  1226.                                  short                     socket);
  1227.  
  1228. EXTERN_API( short )
  1229. GetBridgeAddress                (void);
  1230.  
  1231. EXTERN_API( short )
  1232. BuildBDS                        (Ptr                     buffPtr,
  1233.                                  Ptr                     bdsPtr,
  1234.                                  short                     buffSize);
  1235.  
  1236. EXTERN_API( OSErr )
  1237. MPPOpen                            (void);
  1238.  
  1239. EXTERN_API( OSErr )
  1240. LAPAddATQ                        (ATQEntryPtr             theATQEntry);
  1241.  
  1242. EXTERN_API( OSErr )
  1243. LAPRmvATQ                        (ATQEntryPtr             theATQEntry);
  1244.  
  1245. EXTERN_API( OSErr )
  1246. ATPLoad                            (void);
  1247.  
  1248. EXTERN_API( OSErr )
  1249. ATPUnload                        (void);
  1250.  
  1251. EXTERN_API( OSErr )
  1252. NBPExtract                        (Ptr                     theBuffer,
  1253.                                  short                     numInBuf,
  1254.                                  short                     whichOne,
  1255.                                  EntityName *            abEntity,
  1256.                                  AddrBlock *            address);
  1257.  
  1258. EXTERN_API( OSErr )
  1259. GetNodeAddress                    (short *                myNode,
  1260.                                  short *                myNet);
  1261.  
  1262. EXTERN_API( Boolean )
  1263. IsMPPOpen                        (void);
  1264.  
  1265. EXTERN_API( Boolean )
  1266. IsATPOpen                        (void);
  1267.  
  1268. EXTERN_API( void )
  1269. ATEvent                            (long                     event,
  1270.                                  Ptr                     infoPtr);
  1271.  
  1272. EXTERN_API( OSErr )
  1273. ATPreFlightEvent                (long                     event,
  1274.                                  long                     cancel,
  1275.                                  Ptr                     infoPtr);
  1276.  
  1277. /*
  1278.     The following routines are obsolete and will not be supported on
  1279.     PowerPC. Equivalent functionality is provided by the routines
  1280.     above.
  1281. */
  1282. #if TARGET_CPU_68K
  1283. EXTERN_API( OSErr )
  1284. MPPClose                        (void);
  1285.  
  1286. EXTERN_API( OSErr )
  1287. LAPOpenProtocol                    (ABByte                 theLAPType,
  1288.                                  Ptr                     protoPtr);
  1289.  
  1290. EXTERN_API( OSErr )
  1291. LAPCloseProtocol                (ABByte                 theLAPType);
  1292.  
  1293. EXTERN_API( OSErr )
  1294. LAPWrite                        (ATLAPRecHandle         abRecord,
  1295.                                  Boolean                 async);
  1296.  
  1297. EXTERN_API( OSErr )
  1298. LAPRead                            (ATLAPRecHandle         abRecord,
  1299.                                  Boolean                 async);
  1300.  
  1301. EXTERN_API( OSErr )
  1302. LAPRdCancel                        (ATLAPRecHandle         abRecord);
  1303.  
  1304. EXTERN_API( OSErr )
  1305. DDPOpenSocket                    (short *                theSocket,
  1306.                                  Ptr                     sktListener);
  1307.  
  1308. EXTERN_API( OSErr )
  1309. DDPCloseSocket                    (short                     theSocket);
  1310.  
  1311. EXTERN_API( OSErr )
  1312. DDPRead                            (ATDDPRecHandle         abRecord,
  1313.                                  Boolean                 retCksumErrs,
  1314.                                  Boolean                 async);
  1315.  
  1316. EXTERN_API( OSErr )
  1317. DDPWrite                        (ATDDPRecHandle         abRecord,
  1318.                                  Boolean                 doChecksum,
  1319.                                  Boolean                 async);
  1320.  
  1321. EXTERN_API( OSErr )
  1322. DDPRdCancel                        (ATDDPRecHandle         abRecord);
  1323.  
  1324. EXTERN_API( OSErr )
  1325. ATPOpenSocket                    (AddrBlock                 addrRcvd,
  1326.                                  short *                atpSocket);
  1327.  
  1328. EXTERN_API( OSErr )
  1329. ATPCloseSocket                    (short                     atpSocket);
  1330.  
  1331. EXTERN_API( OSErr )
  1332. ATPSndRequest                    (ATATPRecHandle         abRecord,
  1333.                                  Boolean                 async);
  1334.  
  1335. EXTERN_API( OSErr )
  1336. ATPRequest                        (ATATPRecHandle         abRecord,
  1337.                                  Boolean                 async);
  1338.  
  1339. EXTERN_API( OSErr )
  1340. ATPReqCancel                    (ATATPRecHandle         abRecord,
  1341.                                  Boolean                 async);
  1342.  
  1343. EXTERN_API( OSErr )
  1344. ATPGetRequest                    (ATATPRecHandle         abRecord,
  1345.                                  Boolean                 async);
  1346.  
  1347. EXTERN_API( OSErr )
  1348. ATPSndRsp                        (ATATPRecHandle         abRecord,
  1349.                                  Boolean                 async);
  1350.  
  1351. EXTERN_API( OSErr )
  1352. ATPAddRsp                        (ATATPRecHandle         abRecord);
  1353.  
  1354. EXTERN_API( OSErr )
  1355. ATPResponse                        (ATATPRecHandle         abRecord,
  1356.                                  Boolean                 async);
  1357.  
  1358. EXTERN_API( OSErr )
  1359. ATPRspCancel                    (ATATPRecHandle         abRecord,
  1360.                                  Boolean                 async);
  1361.  
  1362. EXTERN_API( OSErr )
  1363. NBPRegister                        (ATNBPRecHandle         abRecord,
  1364.                                  Boolean                 async);
  1365.  
  1366. EXTERN_API( OSErr )
  1367. NBPLookup                        (ATNBPRecHandle         abRecord,
  1368.                                  Boolean                 async);
  1369.  
  1370. EXTERN_API( OSErr )
  1371. NBPConfirm                        (ATNBPRecHandle         abRecord,
  1372.                                  Boolean                 async);
  1373.  
  1374. EXTERN_API( OSErr )
  1375. NBPRemove                        (EntityPtr                 abEntity);
  1376.  
  1377. EXTERN_API( OSErr )
  1378. NBPLoad                            (void);
  1379.  
  1380. EXTERN_API( OSErr )
  1381. NBPUnload                        (void);
  1382.  
  1383. #endif  /* TARGET_CPU_68K */
  1384.  
  1385.  
  1386. #if PRAGMA_STRUCT_ALIGN
  1387.     #pragma options align=reset
  1388. #elif PRAGMA_STRUCT_PACKPUSH
  1389.     #pragma pack(pop)
  1390. #elif PRAGMA_STRUCT_PACK
  1391.     #pragma pack()
  1392. #endif
  1393.  
  1394. #ifdef PRAGMA_IMPORT_OFF
  1395. #pragma import off
  1396. #elif PRAGMA_IMPORT
  1397. #pragma import reset
  1398. #endif
  1399.  
  1400. #ifdef __cplusplus
  1401. }
  1402. #endif
  1403.  
  1404. #endif /* __APPLETALK__ */
  1405.  
  1406.